"""
@author: tk
@file: game.py
@time: 2022/12/2 16:34
"""
import random

monster = {"极恶之眼": {"死之光": 15, "溟灭": 5, "凝视": 10},
           "骷髅大将": {"渴血": 10, "震颤": 20, "生死轮回": 30},
           "触犯禁忌者": {"禁忌": 25, "枯荣": 25, "蚀骨销魂": 20},
           "旧日支配": {"不可名状": 10, "不可直视": 100, "不可诉说": 1000},
           "虚空恐惧": {"压迫": 10, "恐惧": 20, "绝望": 40}}
hero = {"1": {"蜘蛛女皇": {"剧毒撕咬": 15, "女皇魅惑": 3, "爆裂蜘蛛": 10}},
        "2": {"狼人": {"撕裂": 7, "战栗目光": 20, "血腥屠戮": 30}},
        "3": {"炽天使": {"神威": 20, "圣裁": 25, "无畏": 10}},
        "4": {"帝皇铠甲": {"五行终极斩": 1000, "五门必杀": 200, "五圣必杀": 300}},
        "5": {"田大帅哥": {"绝对无敌": 100000000}}}


class User():
    # 名字、性别、血量、装备、房间
    def __init__(self, name, sex, blood, equip):
        self.name = name
        self.sex = sex
        self.blood = blood
        self.equip = equip

    def hero_blood(self, harm):
        self.blood -= harm
        print(self.blood)


class Room():
    # 房间号， 房间成员
    def __init__(self, roomnum, roompeople):
        self.roomnum = roomnum
        self.roompeople = roompeople


class Boos():
    def __init__(self, name, blood):
        self.name = name
        self.blood = blood

    def boss_blood(self, harm):
        self.blood -= harm
        print("Boss血量:", self.blood)


while 1:
    print("欢迎死斗游戏".center(50, "*"))
    print("1.创建房间\n2.快速匹配(按q退出游戏)")
    op = input("选择:")
    if op == "q":
        break
    elif op == "1":
        num = random.randint(0, 100)
        Room(num, "")
        print("房间创建成功!")
        while 1:
            print("选择您的英雄:")
            print("1.蜘蛛女皇2.狼人3.炽天使4.帝皇铠甲5.田大帅哥6.按q退出房间")
            oph = input("选择:")
            if oph == "q":
                break
            for i in hero[oph].keys():
                print("你已选择英雄:" + i)
            choise = input("是否开启挑战?y/n:")

            if choise == "y":
                boss = random.choice(list(monster))
                print("死斗开始,您即将面临:" + boss)
                every_boss = Boos(boss, 1000)
                every_hero = User(i, "未知", 500, ["初始匕首", "初始战袍", "初始战靴"])
                while 1:
                    cont = input("你的回合(按a使用技能攻击):")
                    if cont == "a":
                        proxyo = random.choice(list(hero[oph][i]))
                        print("你使用", proxyo, "对敌方造成了", hero[oph][i][proxyo], "的伤害")
                        every_boss.boss_blood(hero[oph][i][proxyo])
                        if every_boss.blood <= 0:
                            print("Victory!!!!!!!")
                            print("即将返回房间!")
                            break

                        proxyt = random.choice(list(monster[boss]))
                        print(boss, "发动了", proxyt, "对你造成了", monster[boss][proxyt], "的伤害")
                        every_hero.hero_blood(monster[boss][proxyt])
                        if every_hero.blood <= 0:
                            print("Failure!!!!!!!")
                            print("即将返回房间!")
                            break

            else:
                continue


    elif op == "2":
        num = random.randint(0, 100)  # 随机生成房间号
        hero_num = str(random.randint(1, 5))  # 随机生成英雄序号
        for i in hero[hero_num].keys():
            pass
        bosst = random.choice(list(monster))
        print(i, "VS", bosst)
        every_bosst = Boos(bosst, 1000)
        every_herot = User(i, "未知", 500, ["初始匕首", "初始战袍", "初始战靴"])
        while 1:
            cont = input("你的回合(按a使用技能攻击):")
            if cont == "a":
                proxyo = random.choice(list(hero[hero_num][i]))
                print("你使用", proxyo, "对敌方造成了", hero[hero_num][i][proxyo], "的伤害")
                every_bosst.boss_blood(hero[hero_num][i][proxyo])
                if every_bosst.blood <= 0:
                    print("Victory!!!!!!!")
                    print("即将返回房间!")
                    break

                proxyt = random.choice(list(monster[bosst]))
                print(bosst, "发动了", proxyt, "对你造成了", monster[bosst][proxyt], "的伤害")
                every_herot.hero_blood(monster[bosst][proxyt])
                if every_herot.blood <= 0:
                    print("Failure!!!!!!!")
                    print("即将返回快速匹配界面!")
                    break
